#ifndef COLLECTIONEDITMODEL_H
#define COLLECTIONEDITMODEL_H

#include "collection.h"
#include <QAbstractItemModel>

class CollectionEditModel : public QAbstractItemModel
{
    Q_OBJECT

public:

    enum Field
    {
        Field_NAME = 0,
        Field_VALUE
    };

    explicit CollectionEditModel(QObject *parent = 0);

    void setCollection(Collection* collection);
    Collection* collection() const;
    
    virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
    virtual QModelIndex parent(const QModelIndex &child) const;

    virtual int rowCount(const QModelIndex &parent) const;
    virtual int columnCount(const QModelIndex &parent) const;

    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);

    virtual Qt::ItemFlags flags(const QModelIndex &index) const;


protected:

    CollectionPtr m_collection;


};

#endif // COLLECTIONEDITMODEL_H
